<?php
class DepartmentModel extends model
{
	static $_instance = null;

	static function getInstance ()
	{
		if (is_null(self::$_instance)) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	function getDepartmentListAll(){
		return $this->sql('select * from crm_department where stop=0')->s();
	}
	
	function DepartmentDel($prarm){
		return $this->sql("delete from crm_department where id=[id]",$prarm)->d();
	}
	
	function DepartmentEdit($prarm){
		return $this->sql("update crm_department set `name`='[name]',`contact`='[contact]',`desc`='[desc]' where id=[id]",$prarm)->d();
	}
	
	function DepartmentAdd($prarm){
		return $this->sql("insert into crm_department (`name`,`contact`,`desc`)values('[name]','[contact]','[desc]')",$prarm)->i();
	}
}
?>